"""
Define the Portfolio model
"""
from . import db
from .abc import BaseModel, MetaBaseModel


class Portfolio(db.Model, BaseModel, metaclass=MetaBaseModel):
    """ The Portfolios model """

    __tablename__ = "portfolios"

    name = db.Column(db.String(300), primary_key=True)
    code = db.Column(db.String(300), primary_key=True)
    price = db.Column(db.Float, nullable=True)

    def __init__(self, name, code, price=None):
        """ Create a new Portfolio """
        self.name = name
        self.code = code
        self.price = price
